home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SOURCE.BIN / ListItem.java < prev    next >
Encoding:
Java Source  |  1997-06-19  |  1.4 KB  |  76 lines

  1. package symantec.itools.awt;
  2.  
  3.  
  4. import java.awt.Image;
  5. import java.awt.Color;
  6. import java.awt.FontMetrics;
  7.  
  8.  
  9. /**
  10.  * This class is not public and therefore cannot be used outside this package.
  11.  *
  12.  * @see ImageListBox
  13.  *
  14.  * @version 1.0, Nov 26, 1996
  15.  *
  16.  * @author    Symantec
  17.  *
  18.  */
  19.  
  20.  
  21. class ListItem
  22. {
  23.     Image   image;
  24.     String  sText;
  25.     boolean bEnabled;
  26.     boolean bSelected;
  27.     boolean bDirty;
  28.     Color color;
  29.     int lineWidth;
  30.     boolean bCellBorder;
  31.     Color cellBorderColor;
  32.     boolean bEdited = false;
  33.  
  34.     public ListItem(Image image, String sText, boolean bEnabled, FontMetrics fm, boolean bCellBorder)
  35.     {
  36.         this.image = image;
  37.         this.sText = sText;
  38.         this.bEnabled = bEnabled;
  39.         this.bSelected = false;
  40.         this.bDirty = true;
  41.         this.color = null;
  42.         this.bCellBorder = bCellBorder;
  43.         this.cellBorderColor = Color.black;
  44.         updateWidth(fm);
  45.     }
  46.  
  47.     public void updateWidth(FontMetrics fm)
  48.     {
  49.         if (fm != null)
  50.             this.lineWidth = fm.stringWidth(sText);
  51.         else
  52.             this.lineWidth = 0;
  53.     }
  54.  
  55.     public String toString()
  56.     {
  57.           String s = "ListItem " + sText;
  58.           if (image != null)
  59.               s += " [Image]";
  60.           if (color != Color.black)
  61.               s += " [Colored]";
  62.           if (bEnabled)
  63.               s += " [Enabled]";
  64.           else
  65.               s += " [Disabled]";
  66.           if (bSelected)
  67.               s += " [Selected]";
  68.           else
  69.               s += " [Not Selected]";
  70.           if (bDirty)
  71.               s += " [Dirty]";
  72.         return s;
  73.     }
  74. }
  75.  
  76.